package com.project.service.impl;

import com.project.bean.ProductBean;
import com.project.mapper.IProductMapper;
import com.project.service.IProductService;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

public class ProductServiceImpl extends BaseService implements IProductService {
    @Override
    public void add(ProductBean product) {
        //创建并得到会话对象
        SqlSession session = this.getSession();
        //创建并返回mapper接口对象
        IProductMapper mapper = session.getMapper(IProductMapper.class);
        mapper.add(product);

        //提交事务
        session.commit();
        //关闭连接
        session.close();
    }

    @Override
    public void del(Integer id) {

    }

    @Override
    public void update(Integer id, Integer price) {

    }

    @Override
    public List<ProductBean> findAll() {
        return null;
    }
}
